home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dbcexe / frmnames.frm (.txt) < prev    next >
Visual Basic Form  |  1999-03-30  |  10KB  |  318 lines

  1. VERSION 5.00
  2. Begin VB.Form frmNames 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Names"
  5.    ClientHeight    =   2775
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5850
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2775
  13.    ScaleWidth      =   5850
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.CommandButton cmdName 
  17.       Height          =   375
  18.       Index           =   0
  19.       Left            =   2265
  20.       Picture         =   "frmNames.frx":0000
  21.       Style           =   1  'Graphical
  22.       TabIndex        =   17
  23.       TabStop         =   0   'False
  24.       ToolTipText     =   "New"
  25.       Top             =   2190
  26.       Width           =   375
  27.    End
  28.    Begin VB.CommandButton cmdName 
  29.       Height          =   375
  30.       Index           =   1
  31.       Left            =   2625
  32.       Picture         =   "frmNames.frx":0216
  33.       Style           =   1  'Graphical
  34.       TabIndex        =   16
  35.       ToolTipText     =   "Save"
  36.       Top             =   2190
  37.       Width           =   375
  38.    End
  39.    Begin VB.CommandButton cmdName 
  40.       Height          =   375
  41.       Index           =   2
  42.       Left            =   2985
  43.       Picture         =   "frmNames.frx":04C0
  44.       Style           =   1  'Graphical
  45.       TabIndex        =   15
  46.       ToolTipText     =   "Cancel"
  47.       Top             =   2190
  48.       Width           =   375
  49.    End
  50.    Begin VB.CommandButton cmdName 
  51.       Height          =   375
  52.       Index           =   3
  53.       Left            =   3345
  54.       Picture         =   "frmNames.frx":07D2
  55.       Style           =   1  'Graphical
  56.       TabIndex        =   14
  57.       TabStop         =   0   'False
  58.       ToolTipText     =   "Delete"
  59.       Top             =   2190
  60.       Width           =   375
  61.    End
  62.    Begin VB.CommandButton cmdName 
  63.       Height          =   375
  64.       Index           =   4
  65.       Left            =   3705
  66.       Picture         =   "frmNames.frx":095C
  67.       Style           =   1  'Graphical
  68.       TabIndex        =   13
  69.       TabStop         =   0   'False
  70.       ToolTipText     =   "Next"
  71.       Top             =   2190
  72.       Width           =   375
  73.    End
  74.    Begin VB.CommandButton cmdName 
  75.       Height          =   375
  76.       Index           =   5
  77.       Left            =   1905
  78.       Picture         =   "frmNames.frx":0A2E
  79.       Style           =   1  'Graphical
  80.       TabIndex        =   12
  81.       TabStop         =   0   'False
  82.       ToolTipText     =   "Previous"
  83.       Top             =   2190
  84.       Width           =   375
  85.    End
  86.    Begin VB.TextBox txtForm 
  87.       Height          =   285
  88.       Index           =   5
  89.       Left            =   1785
  90.       TabIndex        =   10
  91.       Top             =   1695
  92.       Width           =   2550
  93.    End
  94.    Begin VB.TextBox txtForm 
  95.       Height          =   285
  96.       Index           =   4
  97.       Left            =   1785
  98.       TabIndex        =   4
  99.       Top             =   1395
  100.       Width           =   2550
  101.    End
  102.    Begin VB.TextBox txtForm 
  103.       Height          =   285
  104.       Index           =   3
  105.       Left            =   1785
  106.       TabIndex        =   3
  107.       Top             =   1095
  108.       Width           =   2550
  109.    End
  110.    Begin VB.TextBox txtForm 
  111.       Height          =   285
  112.       Index           =   2
  113.       Left            =   1785
  114.       TabIndex        =   2
  115.       Top             =   795
  116.       Width           =   2550
  117.    End
  118.    Begin VB.TextBox txtForm 
  119.       Height          =   285
  120.       Index           =   1
  121.       Left            =   1785
  122.       TabIndex        =   1
  123.       Top             =   495
  124.       Width           =   2550
  125.    End
  126.    Begin VB.TextBox txtForm 
  127.       Enabled         =   0   'False
  128.       Height          =   285
  129.       Index           =   0
  130.       Left            =   1785
  131.       TabIndex        =   0
  132.       Top             =   180
  133.       Width           =   2550
  134.    End
  135.    Begin VB.Label lblForm 
  136.       BackStyle       =   0  'Transparent
  137.       Caption         =   "State"
  138.       Height          =   255
  139.       Index           =   5
  140.       Left            =   840
  141.       TabIndex        =   11
  142.       Top             =   1710
  143.       Width           =   1470
  144.    End
  145.    Begin VB.Label lblForm 
  146.       BackStyle       =   0  'Transparent
  147.       Caption         =   "City"
  148.       Height          =   255
  149.       Index           =   4
  150.       Left            =   840
  151.       TabIndex        =   9
  152.       Top             =   1410
  153.       Width           =   1470
  154.    End
  155.    Begin VB.Label lblForm 
  156.       BackStyle       =   0  'Transparent
  157.       Caption         =   "Address"
  158.       Height          =   255
  159.       Index           =   3
  160.       Left            =   840
  161.       TabIndex        =   8
  162.       Top             =   1110
  163.       Width           =   1470
  164.    End
  165.    Begin VB.Label lblForm 
  166.       BackStyle       =   0  'Transparent
  167.       Caption         =   "First Name"
  168.       Height          =   255
  169.       Index           =   2
  170.       Left            =   840
  171.       TabIndex        =   7
  172.       Top             =   810
  173.       Width           =   1470
  174.    End
  175.    Begin VB.Label lblForm 
  176.       BackStyle       =   0  'Transparent
  177.       Caption         =   "Last Name"
  178.       Height          =   255
  179.       Index           =   1
  180.       Left            =   840
  181.       TabIndex        =   6
  182.       Top             =   510
  183.       Width           =   1470
  184.    End
  185.    Begin VB.Label lblForm 
  186.       BackStyle       =   0  'Transparent
  187.       Caption         =   "ID"
  188.       Height          =   255
  189.       Index           =   0
  190.       Left            =   840
  191.       TabIndex        =   5
  192.       Top             =   195
  193.       Width           =   1470
  194.    End
  195. Attribute VB_Name = "frmNames"
  196. Attribute VB_GlobalNameSpace = False
  197. Attribute VB_Creatable = False
  198. Attribute VB_PredeclaredId = True
  199. Attribute VB_Exposed = False
  200. Option Explicit
  201. Private oNames As Names
  202. Private bLoaded As Boolean
  203. '------------------------------------------------------------------------'
  204. Private Sub cmdName_Click(Index As Integer)
  205.     Select Case Index
  206.     Case 0 '--New
  207.         With oNames
  208.             If cmdName(1).Enabled Then
  209.                 .IsNew = False
  210.                 .Save
  211.             End If
  212.             Call .Add
  213.         End With
  214.         cmdName(1).Enabled = True
  215.         cmdName(2).Enabled = True
  216.     Case 1 '--Save
  217.         oNames.IsNew = False
  218.         Call oNames.Save
  219.         cmdName(1).Enabled = False
  220.         cmdName(2).Enabled = False
  221.     Case 2 '--Cancel
  222.         Unload Me
  223.         Exit Sub
  224.     Case 3 '--Delete
  225.         With oNames
  226.             Call .Delete(.ID)
  227.             '-- if no records are left, then you need to display a blank record
  228.             If Not .MoveFirst Then Call .Add
  229.         End With
  230.         cmdName(1).Enabled = False
  231.         cmdName(2).Enabled = False
  232.     Case 4  '--Next
  233.         If cmdName(1).Enabled Then
  234.             oNames.IsNew = False
  235.             oNames.Save
  236.         Else
  237.             oNames.CancelUpdate
  238.         End If
  239.         If Not oNames.MoveNext Then Call oNames.MoveLast
  240.         cmdName(1).Enabled = False
  241.         cmdName(2).Enabled = False
  242.     Case 5  '--Previous
  243.         If cmdName(1).Enabled Then
  244.             oNames.IsNew = False
  245.             oNames.Save
  246.         Else
  247.             oNames.CancelUpdate
  248.         End If
  249.         If Not oNames.MovePrevious Then Call oNames.MoveFirst
  250.         cmdName(1).Enabled = False
  251.         cmdName(2).Enabled = False
  252.     End Select
  253.     Call FillForm(oNames.ID)
  254.     txtForm(1).SetFocus
  255. End Sub
  256. '------------------------------------------------------------------------'
  257. Private Sub Form_Activate()
  258.     With oNames
  259.         .Filter = "ORDER BY LName"
  260.         .Requery
  261.         If Not .MoveFirst Then
  262.             .Add
  263.             .Save
  264.             .MoveFirst
  265.         End If
  266.     End With
  267.     Call FillForm(oNames.ID)
  268.     txtForm(1).SetFocus
  269. End Sub
  270. '------------------------------------------------------------------------'
  271. Private Sub Form_Load()
  272.     Set oNames = New Names
  273. End Sub
  274. '------------------------------------------------------------------------'
  275. Private Sub Form_Unload(Cancel As Integer)
  276.     oNames.CancelUpdate
  277.     Set oNames = Nothing
  278.     Call EndApp
  279. End Sub
  280. '------------------------